/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controllers;

/**
 *
 * @author Le Minh Bui
 */
public class InsulinTank {

    private final int MAXCAPACITY = 300; //Maximale Verbrauchseinheiten.
    private final int MINCAPACITY = 0;
    protected int tankCurrentCapacity;

    /**
     *
     */
    public InsulinTank() {
        tankCurrentCapacity = MAXCAPACITY;
    }

    /**
     *
     * @param capacity
     */
    public InsulinTank(int capacity) {
        setTankCurrentCapacity(capacity);
    }
    
    /**
     * 
     * @param usedUnit 
     */
    public void useInsulinTank(int usedUnit) {
        this.tankCurrentCapacity -= usedUnit;

        if (this.tankCurrentCapacity < MINCAPACITY) {
            this.tankCurrentCapacity = MINCAPACITY;
        }
    }

    /**
     *
     * @param tankCurrentCapacity
     */
    public void setTankCurrentCapacity(int tankCurrentCapacity) {

        if (tankCurrentCapacity > MAXCAPACITY) {
            tankCurrentCapacity = MAXCAPACITY;
        } else if (tankCurrentCapacity < MINCAPACITY) {
            tankCurrentCapacity = MINCAPACITY;
        }
        this.tankCurrentCapacity = tankCurrentCapacity;
    }

    /**
     *
     * @return
     */
    public int getTankCurrentCapacity() {
        return tankCurrentCapacity;
    }

}
